Page({
  data: {
    searchValue: ''
  },
  onInput(e) {
    this.setData({ searchValue: e.detail.value });
  },
  onSearch(e) {
    const value = this.data.searchValue || (e && e.detail && e.detail.value) || '';
    if (value) {
      wx.navigateTo({ url: '/pages/searchResult/index?keyword=' + encodeURIComponent(value) });
    } else {
      wx.showToast({ title: '请输入内容', icon: 'none' });
    }
  },
  goRank() {
    wx.navigateTo({ url: '/pages/rank/rank' });
  },
  goToResult2() {
    wx.navigateTo({ url: '/pages/searchResult/index?keyword=示例' });
  }
}); 